<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:p="http://primefaces.org/ui"
	template="/template/templatePadrao.xhtml">

	<ui:define name="body">
		<div class="padding">

			<h:panelGrid columns="2">
				<p:graphicImage url="/template/imagens/ferramentas.png" />
				<h:panelGroup>
					<h1>
						<p:outputLabel value="Cadastro de equipamentos"
							styleClass="myTopico"
							rendered="#{equipamentoBean.equipamento.id == null}" />
						<p:outputLabel value="Atualizar equipamentos"
							styleClass="myTopico"
							rendered="#{equipamentoBean.equipamento.id != null}" />
					</h1>
				</h:panelGroup>

			</h:panelGrid>
			<p:spacer height="10" />

			<p:panel header="Cadastro de equipamento">
			<t:saveState value="#{equipamentoBean.equipamento}" />
				<h:form>
					<h:panelGrid columns="2">
						<h:panelGroup>
							<h:panelGrid columns="1">
								<p:outputLabel for="nome" value="Nome: " styleClass="myLabel" />
								<p:inputText size="60" id="nome" required="true"
									requiredMessage="Campo nome obrigatório!"
									value="#{equipamentoBean.equipamento.nome}" />
							</h:panelGrid>
						</h:panelGroup>
						<h:panelGroup>
							<h:panelGrid columns="1">
								<p:outputLabel for="marca" value="Marca: " styleClass="myLabel" />
								<p:inputText size="60" id="marca" required="true"
									requiredMessage="Campo marca obrigatório!"
									value="#{equipamentoBean.equipamento.marca}" />
							</h:panelGrid>
						</h:panelGroup>
						<h:panelGroup>
							<h:panelGrid columns="1">
								<p:outputLabel for="quantidade" value="Quantidade: "
									styleClass="myLabel" />
								<p:inputText size="30" id="quantidade" required="true"
									requiredMessage="Campo quantidade obrigatório!"
									value="#{equipamentoBean.equipamento.quantidade}" />
							</h:panelGrid>
						</h:panelGroup>
						<h:panelGroup>
							<h:panelGrid columns="1">
								<p:outputLabel for="observacao" value="Observação: "
									styleClass="myLabel" />
								<p:inputTextarea size="30" id="observacao"
									value="#{equipamentoBean.equipamento.observacao}" />
							</h:panelGrid>
						</h:panelGroup>
					</h:panelGrid>

					<p:separator />
					<p:commandButton value="Salvar" action="#{equipamentoBean.save}"
						ajax="false" update="mensagens"
						rendered="#{equipamentoBean.equipamento.id == null}" />
					<p:commandButton value="Atualizar" 	action="#{equipamentoBean.update}" 
					ajax="false" update="mensagens"
						rendered="#{equipamentoBean.equipamento.id != null}" />

				</h:form>
			</p:panel>
		</div>
	</ui:define>
</ui:composition>